package models;

import play.*;
import play.db.jpa.*;

import javax.persistence.*;
import java.util.*;

@Entity
public class Comment extends Model {
    @Lob
	private String comment;
  
    private Date commentDate;
    private long userId;
    private long userPlaceId;
    public Comment(String comment,User user , UserPlace place){
    	this.comment = comment;
    	this.userId = user.getId();
    	this.userPlaceId = place.getId();
    }
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
	public User getUser() {
	   User user = User.findById(this.getUserId());
	   return user;
	}
	
	
	public void setUser(User user) {
		this.userId = user.getId();
	}
	public UserPlace getUserPlace() {
		UserPlace userPlace = UserPlace.findById(this.getUserPlaceId());
		return userPlace;
	}
	public void setUserPlace(UserPlace userPlace) {
		this.userPlaceId = userPlace.getUserCityId();
	}
	public Date getCommentDate() {
		return commentDate;
	}
	public void setCommentDate(Date commentDate) {
		this.commentDate = commentDate;
	}
	public long getUserId() {
		return userId;
	}
	public void setUserId(long userId) {
		this.userId = userId;
	}
	public long getUserPlaceId() {
		return userPlaceId;
	}
	public void setUserPlaceId(long userPlaceId) {
		this.userPlaceId = userPlaceId;
	}
}
